<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="/interceptor.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>申请休假</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="DatePicker/WdatePicker.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript">
	function submiter(){
		var starttime=document.getElementById("starttime").value;
	    var endtime=document.getElementById("endtime").value;
		var examiner=document.getElementById("examiner").value;
		var start=starttime.split("-");
		var end=endtime.split("-");
	    if(starttime == null||starttime=="" ){
		   alert("开始时间不能为空");
		 }else if(endtime == null||endtime=="" ){
		   alert("结束时间不能为空");
		 }else if(start[0]>end[0]){
			 alert("请选择正确的结束时间");
		 }else if(start[0]>=end[0]&&start[1]>end[1]){
			 alert("请选择正确的结束时间");
		 }else if(start[0]>=start[0]&&start[1]>=end[1]&&start[2]>end[2]){
			 alert("请选择正确的结束时间");
		 }else if(examiner == null||examiner=="" ){
		   alert("请选择审批人");
		 }else{
			document.forms[0].submit();
		}
	}
	
	function back() {
			window.location.href="vacationselectFirstPage";
	}
</script>

</head>

<body>
<form name="myform" action="vacationapplication" method="post">
  	<input type="hidden" name="state" value="0"/> 
	<div class="action">
		<div class="t">
			申请休假
		</div>
		<div class="pages">
			<table width="90%" border="0" cellspacing="0" cellpadding="0">
				<tr>
                    <td align="left"><input type="hidden" name="name" value="${user.userName }" /></td>
				</tr>
				<tr>
					<td align="right" width="30%">开始时间：</td>
                    <td  align="left">
                    	<input type="text" name="startTime" readonly="readonly" onClick="WdatePicker()" id="starttime" />
                        <font color="red">*</font>
                    </td>
				</tr>
				<tr>
					<td align="right" width="30%">结束时间：</td>
                    <td align="left">
                    	<input type="text" name="endTime" readonly="readonly" onClick="WdatePicker()" id="endtime" />
                        <font color="red">*</font>
                    </td>
				</tr>
				<tr>
					<td align="right" width="30%"></td>
                    <td align="left"><input type="hidden" name="days" id="totalday" value="1"/></td>
				</tr>
				<tr>
					<td align="right" width="30%">请假原因：</td>
                    <td align="left"><textarea cols="30" rows="4" name="reason" id="reason"></textarea></td>
				</tr>
                <tr>
					<td align="right" width="30%">审&nbsp;批&nbsp;人：</td>
                    <td align="left">
                    	<select id="examiner" name="checker">
                        	<option value="">请选择</option>
                        <c:forEach var="manage" items="${manageList}">
                        	<c:if test="${user.userName!=manage }">
                        		<option value="${manage}">${manage}</option>
                        	</c:if>
                        </c:forEach>
                        </select>
                   </td>
				</tr>
				<tr>
					<td align="center" colspan="2"><br/>
                    	<input type="button"  id="save" value="提交申请" onclick="submiter();" />
                    	<input type="button"  id="re_to" value="返回" onclick="back();" />
                    </td>
				</tr>
			</table>			
		</div>
	</div>
</form>
</body>
</html>